<%-- 
    Document   : Advisor
    Created on : 7-mag-2012, 19.28.50
    Author     : Ihsan Younes
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8" %>


<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Advisor</title>



<link rel="stylesheet" type="text/css" href="css/bootstrap.css"> <!-- Chiamata al css contenente la grafica -->
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/smoothness/jquery-ui-1.8.19.custom.css" >
<script type="text/javascript" src="js/jquery-ui-1.8.19.custom.min.js" ></script>
  
    <jsp:useBean id = "studenti" class="java.util.List <Utils.Studente_base>" scope="request"> </jsp:useBean>
    <jsp:useBean id = "studyPlan1" class="Utils.StudyPlan" scope="request"> </jsp:useBean>
    <jsp:useBean id = "studyPlan2" class="Utils.StudyPlan" scope="request"> </jsp:useBean>
    <jsp:useBean id = "studyPlan3" class="Utils.StudyPlan" scope="request"> </jsp:useBean> 
    
<script>
            $(document).ready(function (){
               $('#tabs li:eq(0) a').tab('show');
                var x = $(document).height();
                $('#Bottom_bar').css("top", (x+118)+"px");
                $('#Menu_background').css("height" , (x)+"px");
            });

</script> 
  
   <style type="text/css">
        #selectable .ui-selecting { background: #FFFFFF; }
	#selectable .ui-selected { background: #99CBFF; color: black; border: #34FF12; }
</style>

<script type="text/javascript">
	$(function() {
		$("#selectable").selectable(
                { filter : 'tr',                 
                  stop: function() 
                    {
                        
                        str = ($(".ui-selected",this).attr("id"));
                            if(str.match("Row-0"))
                                    $(".ui-selected",this).removeClass("ui-selected");
                            else
                                {
                                document.location.href = "Advisor?ID="+get_selected_index();
                                }
			$(".ui-selected",this).each(function() {
                               $(this).siblings().removeClass("ui-selected");         
		     })}})
	});
        
       function get_selected_index(){
         var elim = document.getElementById(str);
         var x = elim.id;
         return x;
       }
 
</script>

  <script type="text/javascript">
      $(function() {
		$("a.cambiavoto").click(function(event) {
                    $('#Bottom_bar').css("top", "+=50");
                    $('#Menu_background').css("height" , "+=50");
             
                    var x = $(this).parent().parent().attr("id");
                    
                    $(this).parent().html(
             
   "<form method=\"get\" action=\"Advisor\">"
   +"<fieldset>"
   +"<input type=\"text\" class=\"input-small\" name=\"voto\" ><br> "
   +"<input type=\"radio\" name=\"approved\" value=\"approvato\" checked>approvato<br> "
   +"<input type=\"radio\" name=\"approved\" value=\"non approvato\">non appprovato" 
   +"</fieldset> "
   +"<input type=\"submit\" value=\"Canc\" name=\"operazione\">"
   +"<input type=\"submit\" value=\"OK\" name = \"operazione\"> "
   +"<input type=\"hidden\" value=\"voto\" name = \"voto_corso\"> "
   +"<input type=\"hidden\" name =\"corso\" value=\""+x+"\">"
   +"<input type=\"hidden\" name =\"ID\" value=\"<%out.append(""+request.getParameter("ID"));%>\" >"
   +"</form>"
   );

            })
	});
        
</script>


 <script type="text/javascript">
      $(function() {
		$("a.approvaCorso").click(function(event) {
                    $('#Bottom_bar').css("top", "+=50");
                    $('#Menu_background').css("height" , "+=50");           
                    
                    var x = $(this).parent().parent().attr("id");
                    
                    $(this).parent().html(
             
   "<form method=\"get\" action=\"Advisor\">"
   +"<fieldset>"
   +"<input type=\"radio\" name=\"approved\" value=\"approvato\" checked>approvato<br> "
   +"<input type=\"radio\" name=\"approved\" value=\"non approvato\">non appprovato" 
   +"</fieldset> "
   +"<input type=\"submit\" value=\"Canc\" name=\"operazione\">"
   +"<input type=\"submit\" value=\"OK\" name = \"operazione\"> "
   +"<input type=\"hidden\" value=\"corso\" name = \"voto_corso\"> "
   +"<input type=\"hidden\" name =\"corso\" value=\""+x+"\">"
   +"<input type=\"hidden\" name =\"ID\" value=\"<%out.append(""+request.getParameter("ID"));%>\" >"
   +"</form>"
   );

            })
	});
        
</script>





</head>

<body>
     
    
    

<div id="Menu_background"> </div>
<div id="Top_bar"> </div>
<div id="Bottom_bar"> </div>

<div id="Header">
    

	<div id="LOGO_UNITN" class="image" style="position:absolute;left:26px;top:15px;width:339px;height:93px;z-index:0;padding:0;">
	<img src="images/logo_unitn1.gif" id="Image1" alt="" border="0" style="width:339px;height:93px;"></div>

</div>

<div id="SlideMenu1">
<ul class="nav nav-list">
  <li class="nav-header">
    Docente
  </li>
  <li>
    <a href="Corsi_Docente">Corsi</a>
  </li>
  <li class="active">
    <a href="Advisor">Advisor</a>
  </li>
  <li>
    <a href="Logout">Logout</a>
  </li>
</ul>
</div>



<div style="position:absolute;left:190px;top:162px">
    <h3>Studenti associati:</h3>
</div>

<table id="selectable" class="table table-bordered" style="position:absolute;left:190px;top:190px;width:203px">
<tr id ="Row-0">
<th>
Nome
</th>
</tr>
<c:forEach items="${studenti}" var="studente">
                        <tr id="${studente.getMatricola()}">
                            <td style="cursor: pointer"><c:out value="${studente.getCognome()}"/><c:out value="${studente.getNome()}"/></td>
                        </tr>            
</c:forEach>
</table>



<div style="position:absolute;left:416px;top:190px;">
    <ul class="nav nav-tabs" id="tabs">
        <li><a href="#tab1" data-toggle="tab"><h4>Study Plan <% out.append(studyPlan1.getAnno()-1 + "/" + studyPlan1.getAnno()); %></h4></a></li>
        <li><a href="#tab2" data-toggle="tab"><h4>Study Plan<% out.append(studyPlan2.getAnno()-1 + "/" + studyPlan2.getAnno()); %></h4></a></li>
        <li><a href="#tab3" data-toggle="tab"><h4>Study Plan <% out.append(studyPlan3.getAnno()-1 + "/" + studyPlan3.getAnno()); %></h4></a></li>
    </ul> 
        
    <div class="tab-content"> 
        
    <div class="tab-pane" id="tab1">
    <div id="wb_Text6">
    
    
        <h4>Piano di studio:    
            <c:choose>          <c:when test="${studyPlan1.approvato}">
                                    Approvato
                                </c:when>
                                <c:otherwise>
                                    Non approvato
                                </c:otherwise>  </c:choose>
        </h4>
    </div>
                <div>
                    <h6>
                    Crediti Totali <% out.append( (studyPlan1.getCrediti_esterni()+studyPlan1.getCrediti_interni()) + "/" + studyPlan1.getCrediti_necessari()); %>
                    <br>Crediti corsi interni minimi <% out.append(studyPlan1.getCrediti_interni()+ "/" + studyPlan1.getCrediti_interni_necessari()); %>
                    <br>Crediti corsi esterni <% out.append("" +studyPlan1.getCrediti_esterni()); %>
                    </h6>
                </div>
                       <br>
                
                       <div><h4>Corsi Interni </h4></div>
                       
        <table class="table table-bordered">
		<tr id ="Row-0">
		<th style="width:195px">
		Nome
		</th>
		<th style="width:135px">
                Crediti
		</th>
                <th style="width:135px">
		Docente
		</th>
		<th style="width:135px">
		Voto
		</th>
		<th style="width:135px">
		Approvato
		</th>
		<th style="width:135px">
		Completato
		</th>
		</tr>
                <c:forEach items="${studyPlan1.getPlan().values()}" var="plan">
                    <c:if test="${plan.isEsterno()==false}">
                        <tr id="${plan.getId()}">
                            <td><c:out value="${plan.nome}"/></td>
                            <td><c:out value="${plan.crediti}"/></td>
                            <td><c:out value="${plan.nome_docente}"/></td>
                            <td><c:out value="${plan.voto}"/></td>
                            <td>
                            <c:choose> <c:when test="${plan.approvato==true}">
                                    Si  </c:when> <c:otherwise>
                                    <a href="#" class="approvaCorso"> (modifica) </a>  </c:otherwise>  
                            </c:choose>
                            </td>
                            <td>
                            <c:choose> <c:when test="${plan.completato}">
                                    Si  </c:when> <c:otherwise>
                                    No </c:otherwise>  
                            </c:choose>
                            </td>
                        </tr>  
                    </c:if>
                </c:forEach> 
		</table>
                <br>
                
                <div><h4>Corsi Esterni </h4></div>
        <table class="table table-bordered">
		<tr id ="Row-0">
		<th style="width:195px">
		Nome
                </th>
		<th style="width:135px">
		Crediti
		</th>
                <th style="width:135px">
		Docente
		</th>
		<th style="width:135px">
		Voto
		</th>
		<th style="width:135px">
		Approvato
		</th>
		<th style="width:135px">
		Completato
		</th>
		</tr>
                <c:forEach items="${studyPlan1.getPlan().values()}" var="plan">
                    <c:if test="${plan.isEsterno()}">
                        <tr id="${plan.getId()}">
                            <td><c:out value="${plan.nome}"/></td>
                            <td><c:out value="${plan.crediti}"/></td>
                            <td><c:out value="${plan.nome_docente}"/></td>  
                            <td><c:out value="${plan.voto}"/>    
                            <c:if test="${plan.completato == false}">
                                       <a href="#" class="cambiavoto"> (modifica) </a> 
                             </c:if>
                            </td>
                            
                            
                            <td>
                            <c:choose> <c:when test="${plan.approvato}">
                                    Si  </c:when> <c:otherwise>
                                         <a href="#" class="approvaCorso"> (modifica) </a> 
                                    </c:otherwise>  
                            </c:choose>
                            </td>
                            <td>
                            <c:choose> <c:when test="${plan.completato}">
                                    Si  </c:when> <c:otherwise>
                                    No </c:otherwise>  
                            </c:choose>
                            </td>
                        </tr>  
                    </c:if>
                </c:forEach> 
		</table>
              
        
    </div>
    <div class="tab-pane" id="tab2">
    
    <div> 
        <h4>Piano di studio:   
            <c:choose>          <c:when test="${studyPlan2.approvato}">
                                    Approvato
                                </c:when>
                                <c:otherwise>
                                    Non approvato
                                </c:otherwise>  </c:choose>
              
        </h4>
    </div>

                <div>
                    <h6>
                    Crediti Totali <% out.append( (studyPlan2.getCrediti_esterni()+studyPlan2.getCrediti_interni()) + "/" + studyPlan2.getCrediti_necessari()); %>
                    <br>Crediti corsi interni minimi <% out.append(studyPlan2.getCrediti_interni()+ "/" + studyPlan2.getCrediti_interni_necessari()); %>
                    <br>Crediti corsi esterni <% out.append("" +studyPlan2.getCrediti_esterni()); %>
                    </h6>
                </div>
                       <br>
                
                       <div><h4>Corsi Interni</h4></div>
        <table class="table table-bordered">
		<tr id ="Row-0">
		<th style="width:195px">
		Nome
		</th>
		<th style="width:135px">
                Crediti
		</th>
                <th style="width:135px">
		Docente
		</th>
		<th style="width:135px">
		Voto
		</th>
		<th style="width:135px">
		Approvato
		</th>
		<th style="width:135px">
		Completato
		</th>
		</tr>
                <c:forEach items="${studyPlan2.getPlan().values()}" var="plan">
                    <c:if test="${plan.isEsterno()==false}">
                        <tr id="${plan.getId()}">
                            <td><c:out value="${plan.nome}"/></td>
                            <td><c:out value="${plan.crediti}"/></td>
                            <td><c:out value="${plan.nome_docente}"/></td>
                            <td><c:out value="${plan.voto}"/></td>
                            <td>
                            <c:choose> <c:when test="${plan.approvato==true}">
                                    Si  </c:when> <c:otherwise>
                                    <a href="#" class="approvaCorso"> (modifica) </a>  </c:otherwise>  
                            </c:choose>
                            </td>
                            <td>
                            <c:choose> <c:when test="${plan.completato}">
                                    Si  </c:when> <c:otherwise>
                                    No </c:otherwise>  
                            </c:choose>
                            </td>
                        </tr>  
                    </c:if>
                </c:forEach> 
		</table>
                <br>
                
                <div><h4>Corsi Esterni</h4></div>
        <table class="table table-bordered">
		<tr id ="Row-0">
		<th style="width:195px">
		Nome
                </th>
		<th style="width:135px">
		Crediti
		</th>
                <th style="width:135px">
		Docente
		</th>
		<th style="width:135px">
		Voto
		</th>
		<th style="width:135px">
		Approvato
		</th>
		<th style="width:135px">
		Completato
		</th>
		</tr>
                <c:forEach items="${studyPlan2.getPlan().values()}" var="plan">
                    <c:if test="${plan.isEsterno()}">
                        <tr id="${plan.getId()}">
                            <td><c:out value="${plan.nome}"/></td>
                            <td><c:out value="${plan.crediti}"/></td>
                            <td><c:out value="${plan.nome_docente}"/></td>
                            
                            <td><c:out value="${plan.voto}"/> 
                            
                            <c:if test="${plan.completato == false}">
                                       <a href="#" class="cambiavoto"> (modifica) </a> 
                             </c:if>
                            </td>
                            
                            
                            <td>
                            <c:choose> <c:when test="${plan.approvato}">
                                    Si  </c:when> <c:otherwise>
                                         <a href="#" class="approvaCorso"> (modifica) </a> 
                                    </c:otherwise>  
                            </c:choose>
                            </td>
                            <td>
                            <c:choose> <c:when test="${plan.completato}">
                                    Si  </c:when> <c:otherwise>
                                    No </c:otherwise>  
                            </c:choose>
                            </td>
                        </tr>  
                    </c:if>
                </c:forEach> 
		</table>
        
    
    </div>
    <div class="tab-pane" id="tab3">
    
    <div>
        <h4>Piano di studio:   
            <c:choose>          <c:when test="${studyPlan3.approvato}">
                                    Approvato
                                </c:when>
                                <c:otherwise>
                                    Non approvato
                                </c:otherwise>  </c:choose>
        </h4>
    </div>
                
                <div>
                    <h6>
                    Crediti Totali <% out.append( (studyPlan3.getCrediti_esterni()+studyPlan3.getCrediti_interni()) + "/" + studyPlan3.getCrediti_necessari()); %>
                    <br>Crediti corsi interni minimi <% out.append(studyPlan3.getCrediti_interni()+ "/" + studyPlan3.getCrediti_interni_necessari()); %>
                    <br>Crediti corsi esterni <% out.append("" +studyPlan3.getCrediti_esterni()); %>
                    </h6></div>
                <br>
                
                <div><h4>Corsi Interni</h4></div>
        <table class="table table-bordered">
		<tr id ="Row-0">
		<th style="width:195px">
		Nome
		</th>
		<th style="width:135px">
                Crediti
		</th>
                <th style="width:135px">
		Docente
		</th>
		<th style="width:135px">
		Voto
		</th>
		<th style="width:135px">
		Approvato
		</th>
		<th style="width:135px">
		Completato
		</th>
		</tr>
                <c:forEach items="${studyPlan3.getPlan().values()}" var="plan">
                    <c:if test="${plan.isEsterno()==false}">
                        <tr id="${plan.getId()}">
                            <td><c:out value="${plan.nome}"/></td>
                            <td><c:out value="${plan.crediti}"/></td>
                            <td><c:out value="${plan.nome_docente}"/></td>
                            <td><c:out value="${plan.voto}"/></td>
                            <td>
                            <c:choose> <c:when test="${plan.approvato==true}">
                                    Si  </c:when> <c:otherwise>
                                    <a href="#" class="approvaCorso"> (modifica) </a>  </c:otherwise>  
                            </c:choose>
                            </td>
                            <td>
                            <c:choose> <c:when test="${plan.completato}">
                                    Si  </c:when> <c:otherwise>
                                    No </c:otherwise>  
                            </c:choose>
                            </td>
                        </tr>  
                    </c:if>
                </c:forEach> 
		</table>
                <br>
                
                <div><h4>Corsi Esterni</h4></div>
        <table class="table table-bordered">
		<tr id ="Row-0">
		<th style="width:195px">
		Nome
                </th>
		<th style="width:135px">
		Crediti
		</th>
                <th style="width:135px">
		Docente
		</th>
		<th style="width:135px">
		Voto
		</th>
		<th style="width:135px">
		Approvato
		</th>
		<th style="width:135px">
		Completato
		</th>
		</tr>
                <c:forEach items="${studyPlan3.getPlan().values()}" var="plan">
                    <c:if test="${plan.isEsterno()}">
                        <tr id="${plan.getId()}">
                            <td><c:out value="${plan.nome}"/></td>
                            <td><c:out value="${plan.crediti}"/></td>
                            <td><c:out value="${plan.nome_docente}"/></td>
                            
                            <td><c:out value="${plan.voto}"/> 
                            
                            <c:if test="${plan.completato == false}">
                                       <a href="#" class="cambiavoto"> (modifica) </a> 
                             </c:if>
                            </td>
                            
                            
                            <td>
                            <c:choose> <c:when test="${plan.approvato}">
                                    Si  </c:when> <c:otherwise>
                                         <a href="#" class="approvaCorso"> (modifica) </a> 
                                    </c:otherwise>  
                            </c:choose>
                            </td>
                            <td>
                            <c:choose> <c:when test="${plan.completato}">
                                    Si  </c:when> <c:otherwise>
                                    No </c:otherwise>  
                            </c:choose>
                            </td>
                        </tr>  
                    </c:if>
                </c:forEach> 
		</table>
        
        
    </div>
    
</div>
</div>

</body>
</html>